package part1.api.io.iotest;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo2 {
    public static void main(String[] args) throws IOException {
//        FileInputStream fis = new FileInputStream("下载.jpg");
//        FileOutputStream fos = new FileOutputStream("下载3.jpg");
//        byte[] data = new byte[1024*10];
//        int len;
//        while ((len=fis.read(data)) !=-1){
//            fos.write(data,0,len);
//        }
//        System.out.println("复制完毕");
//        fis.close();
//        fos.close();

        FileInputStream fis = new FileInputStream("下载.jpg");
        FileOutputStream fos = new FileOutputStream("下载1.jpg");
        byte[] data = new byte[1024*10];
        int len;
        while ((len=fis.read(data)) !=-1){
            fos.write(data,0,len);
        }
        System.out.println("复制完毕");
        fis.close();
        fos.close();
    }
}
